package com.alatus.ai.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.ai.openai.OpenAiChatClient;
import reactor.core.publisher.Flux;

@RestController
public class OpenAIChatController {
    @Autowired
    private OpenAiChatClient client;
    @GetMapping("/chat")
    public String chat(String question){
        return client.call(question);
    }
    @GetMapping("/chatWithStream")
    public Flux<String> chatWithStream(String question){
        return client.stream(question);
    }
}
